package com.zhentao.controller;

import com.zhentao.model.activity.pojo.AdActivePersonnel;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.service.AdActivePersonnelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("/api/v1/admin/activity")
@Api(tags = "ActrvityPersonnelController-活动报名人员管理")
public class ActrvityPersonnelController {
    @Resource
    AdActivePersonnelService adActivePersonnelService;

    /**
     * 查询活动下所有参与人员
     * @param id
     * @return
     */
    @PostMapping("/selectPersonByActivity")
    @ApiOperation("查询活动下所有参与人员")
    public ResponseResult selectPersonByActivity(@RequestParam("id") Integer id){
        return adActivePersonnelService.selectAllAc(id);
    }

    /**
     * 查询个人参加的所有活动
     * @param id
     * @return
     */
    @PostMapping("/selectActivityByUser/{id}")
    @ApiOperation("查询个人参加的所有活动")
    public ResponseResult selectActivityByUser(@PathVariable("id") Integer id){
        return adActivePersonnelService.selectAllUser(id);
    }

    /**
     *查询个人参加的所有活动
     * @param adActivePersonnel
     * @return
     */
    @PostMapping("/addAc")
    @ApiOperation("新增用户参与表")
    public ResponseResult add(@RequestBody AdActivePersonnel adActivePersonnel){
        return adActivePersonnelService.add(adActivePersonnel);
    }



}
